View Javadoc

1   
2   /*
3    * SmartCrawler
4    *
5    * $Id: SimpleQueue.java,v 1.4 2005/06/27 16:37:49 vincool Exp $
6    * Copyright 2005 Davide Pozza
7    *
8    * This program is free software; you can redistribute it
9    * and/or modify it under the terms of the GNU General Public
10   * License as published by the Free Software Foundation;
11   * either version 2 of the License, or (at your option) any
12   * later version.
13   *
14   * This program is distributed in the hope that it will be
15   * useful, but WITHOUT ANY WARRANTY; without even the implied
16   * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17   * PURPOSE. See the GNU General Public License for more
18   * details.
19   *
20   * You should have received a copy of the GNU General Public
21   * License along with this program; if not, write to the Free
22   * Software Foundation, Inc., 59 Temple Place, Suite 330,
23   * Boston, MA 02111-1307 USA
24   *
25   */
26  
27  package org.smartcrawler.common;
28  
29  import java.util.Vector;
30  
31  
32  /***
33   *
34   *
35   * @author <a href="mailto:pozzad@alice.it">Davide Pozza</a>
36   * @version <tt>$Revision: 1.4 $</tt>
37   */
38  public class SimpleQueue extends Vector implements Queue{
39  
40      //private static Log log = SCLogFactory.getLog(Queue.class);
41  
42      /*** Creates a new instance of Queue */
43      public SimpleQueue() {
44          super();
45      }
46  
47      /***
48       *
49       * @param o
50       */
51      public void put(Object o) {
52          super.add(o);
53      }
54  
55      /***
56       *
57       * @return
58       */
59      public Object get() {
60          Object o = null;
61          if (this.size() > 0) {
62              o = this.firstElement();
63              this.removeElementAt(0);
64          } else {
65              return null;
66          }
67          return o;
68      }
69  
70  
71  
72  }